home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13906 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.5 KB

  1. Path: crc-news.doc.ca!usenet
  2. From: Slobodan Celenkovic <Celenkovic.Bob@ic.gc.ca>
  3. Newsgroups: comp.object,comp.lang.eiffel,comp.lang.c++,comp.lang.beta,comp.lang.java,comp.lang.sather
  4. Subject: Re: What Should An Exception Handling Do? -- Clarification of rules
  5. Date: 27 Mar 1996 22:25:13 GMT
  6. Organization: Industry Canada
  7. Message-ID: <4jcf89$2k9@crc-news.doc.ca>
  8. References: <4irn11$7ln@mimas.brunel.ac.uk> <Pine.Sola.3.91.960322041345.17711C-100000@ux5.cso.uiuc.edu> <4j03p4$fbt@hoho.quake.net> <Doq3sv.MzA@research.att.com>
  9. NNTP-Posting-Host: bouhadrah.mohamed.bsd001.ic.gc.ca
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.22 (Windows; U; 16bit)
  14.  
  15.    So the termination semantics is for cleaning-up just before process 
  16. termination? Of course, that is quite valid viewpoint. However I am still 
  17. not convinced that the resumption semantics is not valid.
  18.  
  19.    Forgive my ignorance, for I did not read the book, but how is the 
  20. following typical example handled: say reading a file with many read 
  21. statements. Classical approach is check errno after each read statement. 
  22. It seems to me that the resumption semantics is much better, since it 
  23. covers all the code and concetrates error handling code into one place, 
  24. at the end. Hence no need for repeated checking of errno. Another nice 
  25. ting about resumption semantics is that it allows selective error 
  26. handling at different levels using clear code. At each level the error 
  27. handlers catch only the errors which it can handle, leaving others for 
  28. the higher levels. Only at the top, application level the termination 
  29. semantics is used because the error condition cannot be corrected.
  30.  
  31.    Indeed it seems to me that both semantics are neeeded and complement 
  32. each other very well. I have no big projects to cite as examples, but my 
  33. personal limited expirience with smaller programs.
  34.  
  35.    So why is the resumption semantics not needed? Of course it can always 
  36. be replaced by explicit error checking, but exceptions seem much 
  37. nicer/cleaner way of catching errors and many error conditions can be 
  38. handled. Maybe it all boils down to the style preference, explicit error 
  39. checking vs. resumption exceptions? In any case, why not give programmers 
  40. the choice?
  41.  
  42. Slobodan Celenkovic
  43.  
  44. P.S.: I used exceptions in Delphi's Pascal language which uses resumption 
  45. semantics until an exception reaches the top level where it causes 
  46. termination. I use exceptions for "normal" errors, like errItemNotFound 
  47. when searching in a table,...
  48.  
  49.